home *** CD-ROM | disk | FTP | other *** search
- Path: onomoto.a2i!onomoto
- From: RjB <onomoto@rahul.net>
- Newsgroups: comp.lang.eiffel,comp.lang.c,comp.lang.c++,comp.object,comp.software-eng
- Subject: Re: Portability of code & skills (Beware of "C" Hackers etc)
- Date: 26 Mar 1996 15:21:35 GMT
- Organization: Object removeFromSystem
- Message-ID: <4j921v$b5q@bug.rahul.net>
- References: <31494D29.4D4B@dmu.ac.uk> <DooBwC.8C0@world.std.com> <65O34-3-3RB@herold.franken.de> <4j8177$18ma@saba.info.ucla.edu>
- NNTP-Posting-Host: foxtrot.rahul.net
- NNTP-Posting-User: onomoto
-
- In article <4j8177$18ma@saba.info.ucla.edu>,
- Jay Martin <jmartin@cs.ucla.edu> wrote:
- >
- >> function CountThem (l: List): integer;
- >> var Count: integer
- >> procedure CountOne (e: ListElement);
- >> begin
- >> if <some condition on e fulfilled> then begin
- >> Count := Count + 1;
- >> end;
- >> end;
- >> begin
- >> ApplyOnList (l, CountOne); (* !!!! *)
- >> CountThem := Count
- >> end;
- >
- >
- >This is what I call side-effects on a global variable (or variable of
- >a larger scope). Its not what I call good programming practice. In
- >fact, I see nested procedures as implemented in algol block languages
- >(automatic importation of variables from larger scopes) as another
- >stupid idea of CS.
-
- Hardly: If CountThem is part of the published interface, then
- how Count is used is immaterial. Not that this matters, because it's
- a secondary issue.
-
- The point that you appear to be missing is that procedures and
- functions are treated in a first-class manner, which is both powerful
- and easy to understand. Compare this to how C/C++ uses pointers to
- functions: it requires a great deal of work to get by the compiler,
- and introduces a tremendous succeptibility to error. And when the
- pointers do get munged, finding the bug isn't necessarily easy.
-
- -rj
- --
- onomoto -- 555 | Infoto Diegoto DODOTO Tobagoto vetoto Texacoto
- bryant st #136 palo | <a href="ftp://ftp.rahul.net/pub/onomoto/RjBXerox.gif">
- alto ca 94301 | Kyototo Oronoto Orinocoto vivoto GINKGOTO.
-